import React from 'react';
import { Redirect } from 'umi';

function useAuth() {
  return { isLogin: Math.random() > 0, isVip: false };
}

export default (props: any) => {
  const { isLogin } = useAuth();
  if (isLogin) {
    return <>{props.children}</>;
  } 
  return <Redirect to="/login" />;
  
};
